﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace MyWeb.Data
{
	public class tblDiscountDAL : SqlDataProvider
	{

		#region[tblDiscount_GetbyAll]
		public DataTable tblDiscount_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblDiscount_GetbyId]
		public DataTable tblDiscount_GetById(tblDiscountInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_did", Data._did));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblDiscount_GetbyTop]
		public DataTable tblDiscount_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblDiscount_Getby_sid]
		public DataTable tblDiscount_GetBy_sid(string _sid)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_GetBy_sid", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_sid", _sid));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblDiscount_Insert]
		public void tblDiscount_Insert(tblDiscountInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_sid", Data._sid));
				cmd.Parameters.Add(new SqlParameter("@_drate", Data._drate));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[tblDiscount_Update]
		public void tblDiscount_Update(tblDiscountInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_sid", Data._sid));
				cmd.Parameters.Add(new SqlParameter("@_did", Data._did));
				cmd.Parameters.Add(new SqlParameter("@_drate", Data._drate));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[tblDiscount_Delete]
		public void tblDiscount_Delete(string Data)
		{
			using (var cmd = new SqlCommand("sp_tblDiscount_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_did", Data));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
	}
}